%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Iteration 6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Iteration 6: SAB Online (Av2)}
In the sixth iteration we decompose the \emph{SAB Online} component. For this decomposition we consider QaS Av2: "SAB Online". The use cases relevant to this are:
\begin{itemize}
 \item UC1: Log in.
 \item UC2: Log off.
 \item UC10: Set up standing order.
 \item UC12: Cancel standing order.
\end{itemize}

We chose to add this log in and log off functionalities with this iteration because SAB Online goes offline from users logging in in peaks. This log in and log off functionality needs to be provided by SAB Online. We chose to add the standing order use cases because according to these use cases they are only performed by SAB Online users.


These drivers can be summarized in the following requirements:
\begin{itemize}
 \item Predictable and unpredictable peaks in customer logins can let the system crash.
 \item The failure of SAB Online can't have any effect on other components.
 \item SAB Online has be be online for 99\% of the time, which corresponds to 3 days and 15.6 hours.
 \item Failure of SAB Online has to be detectable.
 \item The operator must be notified of failure.
 \item The operator has to be able to restart and redeploy the SAB Online application. This whole process can only take 5 minutes.
 \item SAB has to fail correctly, sessions have to be closed and a correct error has to be shown.
 \item Users need to be able to log in and to log off to the system.
 \item SAB Online users need to be able to correctly set up and cancel standing orders from a selected bank account.
\end{itemize}


To satisfy these drivers we considered different availability tactics to find an appropriate solution.
\begin{description}


    % Tactic problem
    \item[Fault detection:] \hfill \\
    
        \vspace{-5mm} 
        \begin{description}
            % solutions for problem
            \item[Ping/echo or Heartbeat:] The System should be able to autonomously detect failure of the web server, so a ping/echo or heartbeat system will be needed that can detect failure of SAB Online within 1 minute.               
        \end{description}
        
        
        
    % Tactic problem
    \item[Fault Recovery:] \hfill \\
    
        \vspace{-5mm} 
        \begin{description}
            % solutions for problem
            \item[Encapsulation:] SAB Online is a system that runs on a webserver and is easy to restart.              
        \end{description}


        
    % Tactic problem
    \item[Fault Prevention:] \hfill \\
    
        \vspace{-5mm} 
        \begin{description}
            % solutions for problem
            \item[Process Monitor:] A process monitor can be used to automatically initialise SAB Online.
            
            \item[Predictive model:] Login peaks are sometimes predictable and can be anticipated, even unpredictable peaks can be detected before they let the webserver crash.
        \end{description}
        
\end{description}


% Insert figure
\begin{figure}[!ht]
    \centering
       \includegraphics[width=1.0\textwidth]{images/It6_Av2_componentdiag.png}
    \caption{Component diagram after iteration 6.}
    \label{fig:It6_Av2_componentdiag}
\end{figure}


To handle the requirements in this iteration we will decompose the \emph{SAB Online} component and provide a \emph{Login Module} to support UC1 and UC2, and add a \emph{Standing Order Module} to support UC10 and UC12 [see figure \ref{fig:It6_Av2_componentdiag}].

The \emph{Login Module} is used by \emph{SAB Online}. It will validate the provided credentials by the user and allows the user to log in. This \emph{Login Module} will be able to access the \emph{Customer Information} facade to access the information needed for validation. SAB Online user sessions are not stored on the system, rather they are stored by the client. Logging out thus requires no interaction with the system.

The \emph{Standing Order Module} will also be used by \emph{SAB Online}. This component will provide the functionality to set up, cancel and process standing orders. \emph{SAB Online} is connected with the \emph{Standing Order Module} so that the user can issue or cancel standing orders. The \emph{Standing Order Module} is connected with the \emph{Account Database} through the \emph{Customer Information} facade to validate and store standing orders. It is also connected to the \emph{Transaction Processing System} so that it can issue Transaction commands to process the periodic transactions.

The \emph{SAB Online} component is decomposed into \emph{SAB Online Website}, \emph{Load Balancer}, \emph{Static Page Cache} and the \emph{SAB Online Monitor}. Incoming requests will enter the \emph{Load Balancer} which can divide the load over multiple web servers that run \emph{SAB Online Website}, or direct static page requests to the \emph{Static Page Cache}.

\emph{SAB Online Website} will run the online platform on a web server and will redirect user requests to the correct components of the internal SAB system. This component can be duplicated to handle requests concurrently.

The \emph{Static Page Cache} will hold static web pages in cache and can be used to cache appropriate error messages to show the user in case of failure of the web server. Handling static page requests is a repetitive lightweight process and can be offloaded to a separate server.  

The \emph{Load Balancer} acts as a router which divides the load of page request over multiple \emph{SAB Online Website} servers and directs static page requests to the \emph{Static Page Cache}.

The \emph{SAB Online Monitor} will monitor the \emph{SAB Online Website} by sending out a ping/echo message each minute. In case failure is detected it will notify the \emph{Operator} which can then redeploy the \emph{SAB Online Website} within 5 minutes. The \emph{SAB Online Website} will send out usages patterns together with each echo, this way the \emph{SAB Online Monitor} can predict long peaks to anticipate them and prevent webserver crashes. The \emph{SAB Online Monitor} can dynamically remove and add \emph{SAB Online Website} servers and keep the \emph{Load Balancer} updated about the status of the servers.


Requirements can be divided over relevant components as follows:
\begin{itemize}

	\item \emph{Static Page Cache}
	\begin{itemize}
		\item Av2: SAB Online should show appropriate error messages in case of failure
	\end{itemize}
	
	
	\item \emph{Load Balancer}
	\begin{itemize}
		\item Av2: SAB Online should have a guaranteed minimal uptime
		\item Av2: Peaks in customer logins should be dealt with
	\end{itemize}
	
	
	\item \emph{SAB Online Website}
	\begin{itemize}
		\item Av2: SAB Online should have a guaranteed minimal uptime
		\item UC9: Issue transfer between two accounts
	\end{itemize}
	
	
	\item \emph{SAB Online Monitor}
	\begin{itemize}
		\item Av2: Failure of SAB Online is detected and notified.
	\end{itemize}
	
	
	\item \emph{Login Module}
	\begin{itemize}
 		\item UC1: Log in
 		\item UC2: Log off
	\end{itemize}
	
	
	\item \emph{Standing Order Module}
	\begin{itemize}
		 \item UC10: Set up standing order
 		\item UC12: Cancel standing order
	\end{itemize}

\end{itemize}






